<?php

	class Transaction_model extends CI_Model {

		protected $__tbname = 'transaction';
		protected $__dbconf = 'default';

		var $id;	//bigint(20) unsigned	Primary Key	Auto Increment	NOT NULL
		var $code;	//varchar(15)	Unique Key		NOT NULL
		var $name;	//varchar(50)			NOT NULL
		var $description;	//varchar(250)			NULL
		var $type;	//tinyint(1) unsigned			NOT NULL
		var $amount;	//double unsigned			NOT NULL
		var $date;	//date			NOT NULL
		var $status = 0;	//tinyint(1) unsigned			NULL
		var $src_acc;	//int(11)			NOT NULL
		var $dest_acc;	//int(11)			NULL

		protected $__validation_rule = array(
			'id' => array('key' => 'PRI', 'type' => 'bigint', 'null' => FALSE, 'auto_increment' => TRUE),
			'code' => array('key' => 'UNI', 'type' => 'varchar', 'size' => 15, 'null' => FALSE),
			'name' => array('type' => 'varchar', 'size' => 50, 'null' => FALSE),
			'description' => array('type' => 'varchar', 'size' => 250, 'null' => TRUE),
			'type' => array('type' => 'tinyint', 'null' => FALSE),
			'amount' => array('type' => 'double unsigned', 'null' => FALSE),
			'date' => array('type' => 'date', 'null' => FALSE),
			'status' => array('type' => 'tinyint', 'null' => TRUE),
			'src_acc' => array('type' => 'int', 'null' => FALSE),
			'dest_acc' => array('type' => 'int', 'null' => TRUE)
		);
	}
